import neurokit2 as nk
import scipy.io as sio
import numpy as np

#耗材
integrated_data = {}
#导入数据
file_paths = ['NinaPro-1/S1_A1_E1.mat','NinaPro-1/S2_A1_E1.mat','NinaPro-1/S3_A1_E1.mat','NinaPro-1/S4_A1_E1.mat','NinaPro-1/S5_A1_E1.mat','NinaPro-1/S6_A1_E1.mat','NinaPro-1/S7_A1_E1.mat','NinaPro-1/S8_A1_E1.mat','NinaPro-1/S9_A1_E1.mat','NinaPro-1/S10_A1_E1.mat','NinaPro-1/S11_A1_E1.mat','NinaPro-1/S12_A1_E1.mat','NinaPro-1/S13_A1_E1.mat','NinaPro-1/S14_A1_E1.mat','NinaPro-1/S15_A1_E1.mat','NinaPro-1/S16_A1_E1.mat','NinaPro-1/S17_A1_E1.mat','NinaPro-1/S18_A1_E1.mat','NinaPro-1/S19_A1_E1.mat','NinaPro-1/S20_A1_E1.mat','NinaPro-1/S21_A1_E1.mat','NinaPro-1/S22_A1_E1.mat','NinaPro-1/S23_A1_E1.mat','NinaPro-1/S24_A1_E1.mat','NinaPro-1/S25_A1_E1.mat','NinaPro-1/S26_A1_E1.mat','NinaPro-1/S27_A1_E1.mat']
for file_path in file_paths:
    data = sio.loadmat(file_path)
    for label in data.keys():
        if isinstance(data["emg"],np.ndarray):
            integrated_data["emg"] = data["emg"]
        if isinstance(data["stimulus"],np.ndarray):
            integrated_data["label"] = data["stimulus"]

print(integrated_data)
sio.savemat('ugodata.mat',integrated_data)
